<?php

/*
 * 订单类
 */

namespace Home\Logic;

class UserLogic {

    public function __construct() {
        $this->u = D('Client_user');
        $this->m = \Think\Memcachectr::create();
    }
    
    public function getUserByAccount($mobile){
        return $this->u->where(array('mobile'=>$mobile))->find();
    }
    
    public function createUser($mobile){
        $data['mobile']=$mobile;
        $data['create_time'] = time();
        $re = $this->u->add($data);
        return $re;
    }

    public function getUserById($id){
        $re = $this->m->get('client_user_'.$id);
        if(!$re){
            $re = $this->u->where(array('id'=>$id))->find();
            $this->m->set('client_user_'.$id,$re);
        }
        return $re;
    }

}
